package com.example.flutter_demo;

import android.view.View;
import android.widget.TextView;

import androidx.core.app.ActivityCompat;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.FlutterEngineCache;
import io.flutter.embedding.engine.dart.DartExecutor;

/**
 * Author by WangYong
 * Date on 2021/7/8
 */
public class FlutterToAndroid extends FlutterActivity {
    @Override
    public void setContentView(View view) {
        super.setContentView(view);
        setContentView(R.layout.flutter_to_android);
        ((TextView)findViewById(R.id.tv_show)).setText(getIntent().getStringExtra("params1"));
//        flutter初始化引擎，放在application中
//        FlutterEngine  fe = new FlutterEngine(this);
//        //通过engine_id唯一标识来缓存
//        fe.getDartExecutor().executeDartEntrypoint(DartExecutor.DartEntrypoint.createDefault());
//        FlutterEngineCache
//                .getInstance()
//                .put("engine_id", fe);
     //跳转Flutter的页面
//        startActivity(FlutterActivity.
//                withNewEngine().
//                initialRoute("image_page").//跳转到image_page页面
//                build(FlutterToAndroid.this));
    }
}
